Page({
  data: {
    name: "",
    age: "",
    users: [
      {
        id: 1,
        uname: "小明1",
      },
      {
        id: 2,
        uname: "小明2",
      },
      {
        id: 3,
        uname: "小明3",
      },
      {
        id: 4,
        uname: "小明4",
      },
    ],
  },
  onLoad(options) {
    console.log("页面onLoad，只触发一次"); // 类似于vue的created
    // 修改数据使用this.setData
    this.setData({
      name: options.name,
      age: options.age,
    });
  },
  onShow() {
    console.log("页面onShow");
  },
  back() {
    wx.navigateBack(); // 返回上一页
    // wx.redirectTo()
    // wx.switchTab();
  },
  onReachBottom() {
    console.log("触底");
    let users = this.data.users;
    users.push(...this.data.users);
    this.setData({
      users: users,
    });
  },
});
